package com.qq.response;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class HttpResult<T> {

    private Boolean sucess;

    private  ErrorInfo errorInfo;

    private T data;

    private String traceId;

    public static <T> HttpResult success(T result){
        return HttpResult.builder()
                .sucess(true)
                .data(result)
                .build();
    }

    public static HttpResult fail(ErrorInfo errorInfo){
        return HttpResult.builder()
                .sucess(false)
                .errorInfo(errorInfo)
                .build();
    }

}
